package com.wujiansima.renyisima.demo.demo2;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo3 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc = new MyCallable();
        FutureTask<String> ft = new FutureTask<String>(mc);
        Thread tr1 = new Thread(ft);
        tr1.setName("wujian");
        tr1.start();
        Thread tr2 = new Thread(ft);

        tr2.setName("ranyi");

        tr2.start();
        String s = ft.get();
        System.out.println(s);

    }
}
